﻿<?php
class Post extends AppModel {
	var $name = 'Post';
	var $displayField = 'tieude';
	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $validate = array(
		'type_id' => array(
			'rule' => 'notEmpty',
			'message' => 'Chọn loại tin'
		),
		'tieude' => array(
			'rule' => 'notEmpty',
			'message' => 'Nhập tiêu đề'
		),
		'noidung' => array(
			'rule' => 'notEmpty',
			'message' => 'Nhập nội dung'
		),
		'thoigiantontai' => array(
			'rule' =>  'numeric',
			'message' => 'Nhập số'
		),
	);
	var $belongsTo = array(
		'Type' => array(
			'className' => 'Type',
			'foreignKey' => 'type_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Catalog' => array(
			'className' => 'Catalog',
			'foreignKey' => 'catalog_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

	var $hasMany = array(
		'Picture' => array(
			'className' => 'Picture',
			'foreignKey' => 'post_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Reply' => array(
			'className' => 'Reply',
			'foreignKey' => 'post_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Userpost' => array(
			'className' => 'Userpost',
			'foreignKey' => 'post_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Customerpost' => array(
			'className' => 'Customerpost',
			'foreignKey' => 'post_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
	);

}
